<template>
	<view class="attend-prograss">
		<pretty-steps  class="step" v-for="(item,index) in tableDate" :item='item' :key='index'></pretty-steps>
	</view>
</template>

<script>
	import service from '../../common/service/new_file.js'
	import apiData from '../../common/utils/apiData.js'
	export default {
		data() {
			return {
				pk_attendreport:'',
				leaveTypeOptions:[],
				list:[
						{	
							name:'王传值',
							activity:1,
							wrapperStatus:'发起',
							wrapperTitle:'xxxx',
							index:1,
							date:'2020-02-20 12:10'
						},
						{
							name:'张三',
							activity:1,
							wrapperStatus:'驳回',
							wrapperTitle:'xxxx',
							index:1,
							date:'2020-02-20 12:10'
						}	,
						{
							name:'张三',
							activity:1,
							wrapperStatus:'审核通过',
							wrapperTitle:'xxxx',
							index:1,
							date:'2020-02-20 12:10'
						}	,
						{
							name:'张三',
							activity:1,
							wrapperStatus:'审核通过',
							wrapperTitle:'xxxx',
							index:1,
							date:'2020-02-20 12:10'
						}	,
						{
							name:'张三',
							activity:1,
							wrapperStatus:'待审核',
							index:0,
						}	
				],
				tableDate:[
					// {senddate:'201-15-1',sendman:'周周',approvestatus:'神恶化',dealman:'组件',checknote:'驳回',billno:'123123123'},
					// {senddate:'201-15-1',sendman:'周周',approvestatus:'神恶化',dealman:'组件',checknote:'驳回',billno:'123123123'},
					// {senddate:'201-15-1',sendman:'周周',approvestatus:'神恶化',dealman:'组件',checknote:'驳回',billno:'123123123'},
					// {senddate:'201-15-1',sendman:'周周',approvestatus:'神恶化',dealman:'组件',checknote:'驳回',billno:'123123123'},
					// {senddate:'201-15-1',sendman:'周周',approvestatus:'神恶化',dealman:'组件',checknote:'驳回',billno:'123123123'},
				]
			};
		},
		methods: {
			// getAllLeaveType() {
			// 	let _this = this;
			// 	let data = apiData.getLeaveTypeData(43, 'leavetype');
			// 	service.common(data, {
			// 		success: function(res) {
			// 			let leaveObj = res.data.VALUES[0];
			// 			let leaveOption = [];
			// 			for (let key in leaveObj) {
			// 				leaveOption.push({
			// 					value: key,
			// 					label: leaveObj[key]
			// 				});
			// 			}
			// 			_this.leaveTypeOptions = leaveOption;
			// 		},
			// 		fail: function(res) {
			// 			console.log(res);
			// 		}
			// 	});
			// },
			getPrograssData(){
				let _this = this
				let data = apiData.setPrograssData(this.pk_attendreport,this.billtype)
				service.common(data,{
					success:function(res){
						let newTabel = res.data.VALUES
						let newList =[]
						newList.push({
							name:newTabel[0].sendman,
							activity:1,
							wrapperStatus:'发起',
							index:1,
							date:newTabel[0].senddate
						})
						
						for(let i =0;i<newTabel.length;i++){
							console.log(newTabel[i])
							let wrapperStatus
							if(i==newTabel.length-1){
								newList.push({
									name:newTabel[i].dealman,
									activity:1,
									checknote:newTabel[i].checknote,//批语
									explain:newTabel[i].explain,//说明
									approveresult:newTabel[i].approveresult,//审批结果
									wrapperStatus:newTabel[i].approvestatus,//当前状态
									index:i==newTabel.length-1?0:1,
								})
							}else{
								newList.push({
									name:newTabel[i].dealman,
									activity:1,
									checknote:newTabel[i].checknote,
									explain:newTabel[i].explain,
									approveresult:newTabel[i].approveresult,
									wrapperStatus:newTabel[i].approvestatus,
									index:i==newTabel.length-1?0:1,
									date:newTabel[i].approvestatus=='运行中'?'':newTabel[i+1].senddate 
								})
							}
						}
						_this.tableDate = newList
					}
				})
			},
		},
		onReady() {
		},
		onPullDownRefresh() {
		this.getPrograssData()
		},
		onLoad(options) {
			this.pk_attendreport = options.pk
			console.log(options.HA01)
			this.billtype = options.billtype
			this.getPrograssData()
		},
	}
</script>

<style lang="scss" scoped>
	.attend-prograss{
		height: 100vh;
		background: #ffffff;
		padding-top: 50rpx;
	}
	.step{
	}
	.salary-list {
		.per-inform {
			margin: 20rpx 30rpx;
		}
	}
</style>
